import request from '../utils/request/request.js'

export default {

	// 月统计可视化
	getMenBillTypeMonth(month) {
		return request({
			url: `/bill/getMenBillTypeMonth/${month}`,
			method: 'get',
		})
	},

// 周统计可视化
	getMenBillTypeWeek(month,week) {
		return request({
			url: `/bill/getMenBillTypeWeek/${month}/${week}`,
			method: 'get',
		})
	},
	// 详细账单信息
	getDetailBill(id) {
		return request({
			url: `/bill/getDetailBill/${id}`,
			method: 'get',
		})
	},
	// 个人消费单
	getBill() {
		return request({
			url: `/bill/getBillByUid`,
			method: 'get'
		})
	},
	// 添加消费单
	addBill(bill) {
		return request({
			url: `/bill/addBill`,
			method: 'post',
			data: bill
		})
	},
	// 条件分页
	getBillByUid(current, limit, query) {
		return request({
			url: `/bill/getBillByUid/${current}/${limit}`,
			method: 'post',
			data: query
		})
	},
	// 分页
	ByUid(current, limit) {
		return request({
			url: `/bill/fyByUid/${current}/${limit}`,
			method: 'post',
		})
	},
	// 删除一个记录
	delBill(id) {
		return request({
			url: `/bill/delBill/${id}`,
			method: 'delete',
		})
	},
	// 修改消费单
	updateBill(billEntity) {
		return request({
			url: `/bill/updateBill`,
			method: 'post',
			data: billEntity
		})
	},
	// 登录
	login(user) {
		return request({
			url: `/user/login`,
			method: 'post',
			data: user
		})
	},
	// 注册
	regsiter(user) {
		return request({
			url: `/user/register`,
			method: 'post',
			data: user
		})
	},
	// 更新
	update(user) {
		return request({
			url: `/user/update`,
			method: 'post',
			data: user
		})
	},
	// 通过token拿用户信息
	getUserInfoByToken() {
		return request({
			url: `/user/getUserInfoByToken`,
			method: 'get',
		})
	}, 
	getOneByid(id) {
		return request({
			url: `/user/getOneByid/${id}`,
			method: 'get',
		})
	}
}
